﻿@using IOA.MES.DataAccess.Enum
@{
    ViewBag.Title = "参数配置核查";
    Layout = "~/Views/Shared/_LayoutPage.cshtml";

    var sites = ViewBag.Sites as List<KeyValuePair<int, string>>;
    var config = ViewBag.Config as IOA.MES.DataAccess.VModel.VViaSiteConfig;
    var pieces = ViewBag.StandardPieces as List<IOA.MES.DataAccess.VModel.VStandardPiece>;
    var workOrderPiece = ViewBag.WorkOrderPiece as IOA.MES.DataAccess.VModel.VStandardPiece;
    var schemas = ViewBag.Schemas as List<IOA.MES.DataAccess.VModel.VBinningSchema>;
    var workOrderBinningSchema = ViewBag.WorkOrderBinningSchema as IOA.MES.DataAccess.VModel.VWorkOrderBinningSchema;
    var packCondition = ViewBag.PackCondition as IOA.MES.DataAccess.VModel.VPackCondition;
    var cabinetCondition = ViewBag.CabinetCondition as IOA.MES.DataAccess.VModel.VCabinetCondition;
    var label = ViewBag.Label as IOA.MES.DataAccess.VModel.VWorkorderLable;
}
@section Contents{
    <style>
        html {
            background-color: #FFF;
        }

        .layui-table-cell {
            height: auto;
        }
    </style>
}

<div id="page"></div>

<script type="text/template" id="tplPage">
    <div style="background-color:white;padding:10px;margin:15px">
        <div class="layui-tab">
            <ul class="layui-tab-title">
                <li class="layui-this">{{lang.Field.BomSettings}}</li>
                <li>{{lang.Field.StationConfig}}</li>
                <li>{{lang.Field.StandardTabletBind}}</li>
                <li>{{lang.Field.GradingRules}}</li>
                <li>{{lang.Field.IvUploadConfig}}</li>
                <li>{{lang.Field.NameplateLabel}}</li>
                <li>{{lang.Field.QTimeConfig}}</li>
                <li>{{lang.Field.PackConditionConfig}}</li>
                <li>{{lang.Field.CabinetConditionConfig}}</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <div class="layui-card">
                        @foreach (var item in sites)
                        {
                            <div class="layui-card-body">
                                <input name="ikey" type="hidden" value="@item.Key" />
                                <h3 style="font-weight:bold">{{lang.Field.SiteName}}：@item.Value </h3>
                                <p style="margin:5px 0">
                                    {{lang.Field.DeductionList}}:
                                </p>
                                <table id="table@(item.Key)" lay-filter="table"></table>
                            </div>
                        }
                    </div>
                </div>
                <div class="layui-tab-item">
                    <div class="layui-form">
                        @foreach (var site in sites)
                        {
                            <div class="layui-form-item viasite" sitetype="@((int)site.Key)">
                                <label class="layui-form-label">@site.Value</label>
                                <div class="layui-input-block">
                                    <input type="checkbox" lay-skin="primary" title="可重复过站" disabled class="MultipleVia" @(config.ConfigModel.ViaSites.FirstOrDefault(_ => (int)_.SiteType == site.Key)?.MultipleVia ?? false ? "checked" : "")>
                                    <input type="checkbox" lay-skin="primary" title="必须过站" disabled class="ForceVia" @(config.ConfigModel.ViaSites.FirstOrDefault(_ => (int)_.SiteType == site.Key)?.ForceVia ?? true ? "checked" : "")>
                                </div>
                            </div>
                        }

                        <div class="layui-form-item" pane="">
                            <label class="layui-form-label">装框</label>
                            <div class="layui-input-block">
                                <input type="checkbox" name="JunctionBoxPhoto" lay-skin="primary" disabled title="接线盒拍照" @(config.ConfigModel.Framing.JunctionBoxPhoto ? "checked" : "")>
                                <input type="checkbox" name="JunctionBoxBarCodeScan" lay-skin="primary" disabled title="接线盒需扫码" @(config.ConfigModel.Framing.JunctionBoxBarCodeScan ? "checked" : "")>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-tab-item">
                    <div class="layui-form" lay-filter="layuiadmin-app-form-list" style="padding: 20px 30px;">
                        <div class="layui-form-item">
                            <label class="layui-form-label">{{lang.Field.StandardTabletCode}}：</label>
                            <div class="layui-input-inline">
                                <select id="selPieces" disabled lay-filter="selPieces" lay-search="">
                                    <option value="0">选择标片</option>
                                    @foreach (var item in pieces)
                                    {
                                        <option value="@item.PkId" @(workOrderPiece != null && workOrderPiece.PkId == item.PkId ? " selected" : "")>@item.ProductCode</option>
                                    }
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">标片型号：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="workOrderPiece" value="@(workOrderPiece==null?string.Empty:workOrderPiece.Model)" disabled class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">Pmax：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="Pmax" value="@(workOrderPiece==null?string.Empty:$"{workOrderPiece.Pmax}"+(workOrderPiece.PmaxToleranceUp==workOrderPiece.PmaxToleranceDown?$"±{workOrderPiece.PmaxToleranceDown}":$"-{workOrderPiece.PmaxToleranceDown}+{workOrderPiece.PmaxToleranceUp}"))" disabled class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">Voc：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="Voc" value="@(workOrderPiece==null?string.Empty:$"{workOrderPiece.Voc}"+(workOrderPiece.VocToleranceUp==workOrderPiece.VocToleranceDown?$"±{workOrderPiece.VocToleranceDown}":$"-{workOrderPiece.VocToleranceDown}+{workOrderPiece.VocToleranceUp}"))" disabled class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">Isc：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="Isc" value="@(workOrderPiece==null?string.Empty:$"{workOrderPiece.Isc}"+(workOrderPiece.IscToleranceUp==workOrderPiece.IscToleranceDown?$"±{workOrderPiece.IscToleranceDown}":$"-{workOrderPiece.IscToleranceDown}+{workOrderPiece.IscToleranceUp}"))" disabled class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">Vmp：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="Vmp" value="@(workOrderPiece==null?string.Empty:$"{workOrderPiece.Vmp}"+(workOrderPiece.VmpToleranceUp==workOrderPiece.VmpToleranceDown?$"±{workOrderPiece.VmpToleranceDown}":$"-{workOrderPiece.VmpToleranceDown}+{workOrderPiece.VmpToleranceUp}"))" disabled class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">Imp：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="Imp" value="@(workOrderPiece==null?string.Empty:$"{workOrderPiece.Imp}"+(workOrderPiece.ImpToleranceUp==workOrderPiece.ImpToleranceDown?$"±{workOrderPiece.ImpToleranceDown}":$"-{workOrderPiece.ImpToleranceDown}+{workOrderPiece.ImpToleranceUp}"))" disabled class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">FF：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="FF" value="@(workOrderPiece==null?string.Empty:$"{workOrderPiece.FF}"+(workOrderPiece.FFToleranceUp==workOrderPiece.FFToleranceDown?$"±{workOrderPiece.FFToleranceDown}":$"-{workOrderPiece.FFToleranceDown}+{workOrderPiece.FFToleranceUp}"))" disabled class="layui-input">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-tab-item">
                    <div class="layui-card">
                        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
                            <div class="layui-form-item">
                                <label class="layui-form-label">分档方案：</label>
                                <div class="layui-input-inline">
                                    <select id="selSchemas" name="BinningSchemeId" lay-filter="selSchemas" lay-search="" disabled>
                                        <option value="0">选择分档方案</option>
                                        @foreach (var item in schemas)
                                        {
                                            <option value="@item.PkId" @(workOrderBinningSchema != null && workOrderBinningSchema.BinningSchemeId == item.PkId ? " selected" : "")>@item.SchemaName</option>
                                        }
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-card">
                        <div class="layui-card-body">
                            <table id="tableSchema" lay-filter="tableSchema"></table>
                        </div>
                    </div>
                </div>
                <div class="layui-tab-item">
                    <div class="layui-form">
                        <div class="layui-form-item" pane="">
                            <label class="layui-form-label">IV上传配置</label>
                            <div class="layui-input-block">
                                <input type="checkbox" name="Graph" lay-skin="primary" title="曲线图上传" disabled @(config.ConfigModel.IVUpload?.Graph ?? true ? "checked" : "")>
                                <input type="checkbox" name="RfidDot" lay-skin="primary" title="IV点数据上传" disabled @(config.ConfigModel.IVUpload?.RfidDot ?? true ? "checked" : "")>
                                <input type="checkbox" name="Burn" lay-skin="primary" title="是否烧录" disabled @(config.ConfigModel.IVUpload?.Burn ?? true ? "checked" : "")>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-tab-item">
                    <div class="layui-card">
                        <div class="layui-card-body layui-form">
                            <div class="layui-form-item">
                                <label class="layui-form-label">序列号</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="SerialNum" readonly autocomplete="off" class="layui-input" value="@(label==null?string.Empty:label.SerialNum)">
                                </div>
                                <a class="layui-btn layuiadmin-btn-list btndownload" target="blank" href="/Common/Download?url=@(HttpUtility.UrlEncode(label?.SerialNum))">
                                    <i class="layui-icon">&#xe67c;</i>下载
                                </a>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">边框条码</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="BorderBarCode" readonly autocomplete="off" class="layui-input" value="@(label==null?string.Empty:label.BorderBarCode)">
                                </div>
                                <a class="layui-btn layuiadmin-btn-list btndownload" target="blank" href="/Common/Download?url=@(HttpUtility.UrlEncode(label?.BorderBarCode))">
                                    <i class="layui-icon">&#xe67c;</i>下载
                                </a>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">铭牌</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="Nameplate" readonly autocomplete="off" class="layui-input" value="@(label==null?string.Empty:label.Nameplate)">
                                </div>
                                <a class="layui-btn layuiadmin-btn-list btndownload" target="blank" href="/Common/Download?url=@(HttpUtility.UrlEncode(label?.Nameplate))">
                                    <i class="layui-icon">&#xe67c;</i>下载
                                </a>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">电流标签</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="CurrentTag" readonly autocomplete="off" class="layui-input" value="@(label==null?string.Empty:label.CurrentTag)">
                                </div>
                                <a class="layui-btn layuiadmin-btn-list btndownload" target="blank" href="/Common/Download?url=@(HttpUtility.UrlEncode(label?.CurrentTag))">
                                    <i class="layui-icon">&#xe67c;</i>下载
                                </a>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">能源标签</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="EnergyTag" readonly autocomplete="off" class="layui-input" value="@(label==null?string.Empty:label.EnergyTag)">
                                </div>
                                <a class="layui-btn layuiadmin-btn-list btndownload" target="blank" href="/Common/Download?url=@(HttpUtility.UrlEncode(label?.EnergyTag))">
                                    <i class="layui-icon">&#xe67c;</i>下载
                                </a>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">唛头</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="Mark" readonly autocomplete="off" class="layui-input" value="@(label==null?string.Empty:label.Mark)">
                                </div>
                                <a class="layui-btn layuiadmin-btn-list btndownload" target="blank" href="/Common/Download?url=@(HttpUtility.UrlEncode(label?.Mark))">
                                    <i class="layui-icon">&#xe67c;</i>下载
                                </a>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">托盘号标签</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="PallNumTag" readonly autocomplete="off" class="layui-input" value="@(label==null?string.Empty:label.PallNumTag)">
                                </div>
                                <a class="layui-btn layuiadmin-btn-list btndownload" target="blank" href="/Common/Download?url=@(HttpUtility.UrlEncode(label?.PallNumTag))">
                                    <i class="layui-icon">&#xe67c;</i>下载
                                </a>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">
                                    FR报表
                                </label>
                                <div class="layui-input-inline">
                                    <input type="text" name="FrChart" readonly autocomplete="off" class="layui-input" value="@(label==null?string.Empty:label.FrChart)">
                                </div>
                                <a class="layui-btn layuiadmin-btn-list btndownload" target="blank" href="/Common/Download?url=@(HttpUtility.UrlEncode(label?.FrChart))">
                                    <i class="layui-icon">&#xe67c;</i>下载
                                </a>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">OBA数据</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="OBAData" readonly autocomplete="off" class="layui-input" value="@(label==null?string.Empty:label.OBAData)">
                                </div>
                                <a class="layui-btn layuiadmin-btn-list btndownload" target="blank" href="/Common/Download?url=@(HttpUtility.UrlEncode(label?.OBAData))">
                                    <i class="layui-icon">&#xe67c;</i>下载
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-tab-item">
                    <div class="layui-form">
                        <div class="layui-form-item" pane="">
                            <label class="layui-form-label">层压时间（分钟）</label>
                            <div class="layui-input-inline">
                                <input type="number" name="LaminatedTime" min="0" disabled value="@(config.ConfigModel.QTime?.LaminatedTime)" autocomplete="off" class="layui-input">
                            </div>

                        </div>
                        <div class="layui-form-item" pane="">
                            <label class="layui-form-label">固化时间（分钟）</label>
                            <div class="layui-input-inline">
                                <input type="number" name="SolidifyTime" min="0" disabled value="@(config.ConfigModel.QTime?.SolidifyTime)" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item" pane="">
                            <label class="layui-form-label">返修时效（分钟）</label>
                            <div class="layui-input-inline">
                                <input type="number" name="ReworkTime" min="0" disabled value="@(config.ConfigModel.QTime?.ReworkTime)" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-tab-item">
                    <div class="layui-form">
                        <div class="layui-form-item">
                            <label class="layui-form-label">满托数量</label>
                            <div class="layui-input-inline">
                                <input type="number" name="QuantityLimit" min="0" value="@(packCondition?.QuantityLimit)" disabled class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item" pane="">
                            <label class="layui-form-label">包装条件</label>
                            <div class="layui-input-block">
                                <input type="checkbox" name="OrderNoLimit" lay-skin="primary" title="订单号" disabled @(packCondition?.OrderNoLimit ?? false ? "checked" : "")>
                                <input type="checkbox" name="WorkOrderNoLimit" lay-skin="primary" title="工单号" disabled @(packCondition?.WorkOrderNoLimit ?? false ? "checked" : "")>
                                <input type="checkbox" name="DataPlate" lay-skin="primary" title="铭牌型号" disabled @(packCondition?.DataPlate ?? false ? "checked" : "")>
                                <input type="checkbox" name="RatedPower" lay-skin="primary" title="额定功率" disabled @(packCondition?.RatedPower ?? false ? "checked" : "")>
                                <input type="checkbox" name="ElectricGrade" lay-skin="primary" title="电流档" disabled @(packCondition?.ElectricGrade ?? false ? "checked" : "")>
                                <input type="checkbox" name="CompGrade" lay-skin="primary" title="组件等级" disabled @(packCondition?.CompGrade ?? false ? "checked" : "")>
                                <input type="checkbox" name="CompColor" lay-skin="primary" title="组件颜色" disabled @(packCondition?.CompColor ?? false ? "checked" : "")>
                                <input type="checkbox" name="JunBoxSpecs" lay-skin="primary" title="接线盒规格" disabled @(packCondition?.JunBoxSpecs ?? false ? "checked" : "")>
                                <input type="checkbox" name="JunBoxFactory" lay-skin="primary" title="接线盒厂家" disabled @(packCondition?.JunBoxFactory ?? false ? "checked" : "")>
                                <input type="checkbox" name="BackPlanSpecs" lay-skin="primary" title="背板规格" disabled @(packCondition?.BackPlanSpecs ?? false ? "checked" : "")>
                                <input type="checkbox" name="BackPlanFactory" lay-skin="primary" title="背板厂家" disabled @(packCondition?.BackPlanFactory ?? false ? "checked" : "")>
                                <input type="checkbox" name="AluFrameSpecs" lay-skin="primary" title="铝框规格" disabled @(packCondition?.AluFrameSpecs ?? false ? "checked" : "")>
                                <input type="checkbox" name="AluFrameFactory" lay-skin="primary" title="铝框厂家" disabled @(packCondition?.AluFrameFactory ?? false ? "checked" : "")>
                                <input type="checkbox" name="BatterySpecs" lay-skin="primary" title="电池片规格" disabled @(packCondition?.BatterySpecs ?? false ? "checked" : "")>
                                <input type="checkbox" name="BatteryFactory" lay-skin="primary" title="电池片厂家" disabled @(packCondition?.BatteryFactory ?? false ? "checked" : "")>
                            </div>
                        </div>
                    </div>
                </div>
                <div class=" layui-tab-item">
                    <div class="layui-form">
                        <div class="layui-form-item" pane="">
                            <label class="layui-form-label">拼柜条件</label>
                            <div class="layui-input-block">
                                <input type="checkbox" name="OrderNoLimit" lay-skin="primary" title="订单号" disabled @(cabinetCondition?.OrderNoLimit ?? false ? "checked" : "")>
                                <input type="checkbox" name="WorkOrderNoLimit" lay-skin="primary" title="工单号" disabled @(cabinetCondition?.WorkOrderNoLimit ?? false ? "checked" : "")>
                                <input type="checkbox" name="DataPlate" lay-skin="primary" title="铭牌型号" disabled @(cabinetCondition?.DataPlate ?? false ? "checked" : "")>
                                <input type="checkbox" name="RatedPower" lay-skin="primary" title="额定功率" disabled @(cabinetCondition?.RatedPower ?? false ? "checked" : "")>
                                <input type="checkbox" name="ElectricGrade" lay-skin="primary" title="电流档" disabled @(cabinetCondition?.ElectricGrade ?? false ? "checked" : "")>
                                <input type="checkbox" name="CompGrade" lay-skin="primary" title="组件等级" disabled @(cabinetCondition?.CompGrade ?? false ? "checked" : "")>
                                <input type="checkbox" name="CompColor" lay-skin="primary" title="组件颜色" disabled @(cabinetCondition?.CompColor ?? false ? "checked" : "")>
                                <input type="checkbox" name="JunBoxSpecs" lay-skin="primary" title="接线盒规格" disabled @(cabinetCondition?.JunBoxSpecs ?? false ? "checked" : "")>
                                <input type="checkbox" name="JunBoxFactory" lay-skin="primary" title="接线盒厂家" disabled @(cabinetCondition?.JunBoxFactory ?? false ? "checked" : "")>
                                <input type="checkbox" name="BackPlanSpecs" lay-skin="primary" title="背板规格" disabled @(cabinetCondition?.BackPlanSpecs ?? false ? "checked" : "")>
                                <input type="checkbox" name="BackPlanFactory" lay-skin="primary" title="背板厂家" disabled @(cabinetCondition?.BackPlanFactory ?? false ? "checked" : "")>
                                <input type="checkbox" name="AluFrameSpecs" lay-skin="primary" title="铝框规格" disabled @(cabinetCondition?.AluFrameSpecs ?? false ? "checked" : "")>
                                <input type="checkbox" name="AluFrameFactory" lay-skin="primary" title="铝框厂家" disabled @(cabinetCondition?.AluFrameFactory ?? false ? "checked" : "")>
                                <input type="checkbox" name="BatterySpecs" lay-skin="primary" title="电池片规格" disabled @(cabinetCondition?.BatterySpecs ?? false ? "checked" : "")>
                                <input type="checkbox" name="BatteryFactory" lay-skin="primary" title="电池片厂家" disabled @(cabinetCondition?.BatteryFactory ?? false ? "checked" : "")>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</script>

@section Scripts{
    <script>
        var vm = new Vue({
            el: "#page",
            template: "#tplPage",
            data: {
                lang: JSON.parse(lang).package
            }
        });
        var pieces = @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(pieces));

        setTimeout(function () {
            initLayui();
        }, 50);

        function initLayui() {
            layui.use(['table', 'layer', 'element'], function () {
                var layer = layui.layer,
                    table = layui.table;

                for (var ik = 0; ik < $("input[name='ikey']").length; ik++) {
                    var tv = $("input[name='ikey']:eq(" + ik + ")").val();
                    var tid = 'table' + tv;
                    var options = {
                        elem: '#' + tid
                        , id: tid
                        , url: '/ParaSetting/QueryProductSiteBom'
                        , method: "post"
                        , where: { workOrderNo: "@ViewBag.WorkOrderNo", siteType: tv }
                        , page: true
                        , limit: 15
                        , limits: [15, 20, 25, 30, 40, 50]
                        , response: {
                            statusName: 'ErrCode'
                            , statusCode: 200
                            , msgName: 'ErrCode'
                            , countName: 'TotalCount'
                            , dataName: 'Data'
                        }
                        , cols: [[
                            { type: 'numbers', title: '序号', width: 60 }
                            , { field: 'BomCategoryCode', title: '分类代码' }
                            , { field: 'BomCategoryName', title: '分类名称' }
                            , { field: 'BomProductCode', title: '成品料号' }
                            , { field: 'BomProductName', title: '成品名称' }
                            , { field: 'BomCount', title: '扣料数量' }
                        ]]
                    };

                    table.render(options);
                }

                initPieceForm();
                function initPieceForm() {
                    if (pieces.length <= 0) {
                        return;
                    }

                    var piece = pieces.find(function (e) {
                        return e.PkId == $("#selPieces").val();
                    });
                    if (piece) {
                        $("input[name=Model]").val(piece.Model);
                        $("input[name=Pmax]").val(piece.Pmax + "±" + piece.PmaxTolerance);
                        $("input[name=Voc]").val(piece.Voc + "±" + piece.VocTolerance);
                        $("input[name=Isc]").val(piece.Isc + "±" + piece.IscTolerance);
                        $("input[name=Vmp]").val(piece.Vmp + "±" + piece.VmpTolerance);
                        $("input[name=Imp]").val(piece.Imp + "±" + piece.ImpTolerance);
                        $("input[name=FF]").val(piece.FF + "±" + piece.FFTolerance);
                    } else {
                        $("input[name=Model]").val("");
                        $("input[name=Pmax]").val("");
                        $("input[name=Voc]").val("");
                        $("input[name=Isc]").val("");
                        $("input[name=Vmp]").val("");
                        $("input[name=Imp]").val("");
                        $("input[name=FF]").val("");
                    }
                }

                table.render({
                    elem: '#tableSchema'
                    , url: '/ParaSetting/QueryBinningPowers'
                    , method: "post"
                    , where: { schemaId: parseInt($("#selSchemas").val().trim()) }
                    , response: {
                        statusName: 'ErrCode'
                        , statusCode: 200
                        , msgName: 'ErrCode'
                        , countName: 'TotalCount'
                        , dataName: 'Data'
                    }
                    , cols: [[
                        { title: '序号', type: "numbers", width: 60 }
                        , {
                            title: '额定功率', templet: function (d) {
                                return d.Power + "W";
                            }
                        }
                        , {
                            title: '电流档位', templet: function (d) {
                                var powers = new Array();
                                for (i = 0; i < d.Currents.length; i++) {
                                    powers.push(d.Currents[i].LevelName + "：" + d.Currents[i].CurrentMin + "A - " + d.Currents[i].CurrentMax + "A");
                                }
                                return powers.join("<br/>");
                            }
                        }
                    ]]
                });

                $(document).on("click", ".btndownload", function () {
                    var name = $(this).attr("id").replace("btn", "");
                    var url = $("input[name=" + name + "]").val();
                    location.href = "/Common/";
                });
            });
        }
    </script>
}

